home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 May / may_2001.iso / intercd / root / Multimedia / ^DivX_Article / virtualdub / VirtualDub-source-1_4d / capwarn.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-20  |  3.6 KB  |  140 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    Copyright (C) 1998-2001 Avery Lee
  3. //
  4. //    This program is free software; you can redistribute it and/or modify
  5. //    it under the terms of the GNU General Public License as published by
  6. //    the Free Software Foundation; either version 2 of the License, or
  7. //    (at your option) any later version.
  8. //
  9. //    This program is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. //    GNU General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU General Public License
  15. //    along with this program; if not, write to the Free Software
  16. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #include <string.h>
  19. #include <windows.h>
  20. #include "oshelper.h"
  21. #include "helpfile.h"
  22.  
  23. extern const char g_szCapture[];
  24. static const char g_szCaptureWarn[]="Disabled Warnings";
  25.  
  26. #define CWF_PINNACLE        (0x00000001L)
  27. #define CWF_ZORAN            (0x00000002L)
  28. #define CWF_BROOKTREE        (0x00000004L)
  29.  
  30. static long g_capwarnFlags = -1;
  31.  
  32. static void CaptureWarnInit() {
  33.     if (g_capwarnFlags < 0)
  34.         if (!QueryConfigDword(g_szCapture, g_szCaptureWarn, (DWORD *)&g_capwarnFlags))
  35.             g_capwarnFlags = 0;
  36. }
  37.  
  38. static void CaptureWarnDisable(long f) {
  39.     g_capwarnFlags |= f;
  40.     SetConfigDword(g_szCapture, g_szCaptureWarn, g_capwarnFlags);
  41. }
  42.  
  43. void CaptureWarnCheckDriver(HWND hwnd, const char *s) {
  44.     CaptureWarnInit();
  45.  
  46.     if (!(g_capwarnFlags & CWF_PINNACLE) && (strstr(s, "Pinnacle") || strstr(s, "miroVIDEO"))) {
  47.  
  48.         if (IDYES == MessageBox(hwnd,
  49.             "You may experience slow GUI performance while this driver "
  50.             "is active, depending on your video card.  Do you want to "
  51.             "know more about this problem?"
  52.             ,
  53.             "Miro/Pinnacle Systems driver detected",
  54.             MB_YESNO)) {
  55.  
  56.             HelpPopup(hwnd, IDH_CAPWARN_PINNACLE);
  57.         }
  58.  
  59.         CaptureWarnDisable(CWF_PINNACLE);
  60.     }
  61. }
  62.  
  63. void CaptureWarnCheckDrivers(HWND hwnd) {
  64.     HANDLE hFind;
  65.     WIN32_FIND_DATA wfd;
  66.     char szPath[MAX_PATH], *s;
  67.  
  68.     if (!(g_capwarnFlags & CWF_ZORAN)) {
  69.         GetWindowsDirectory(szPath, sizeof szPath);
  70.         s = szPath;
  71.         while(*s) ++s;
  72.         if (s[-1] != '\\')
  73.             *s++ = '\\';
  74.  
  75.         strcpy(s, "system\\h20capt.dll");
  76.  
  77.         hFind = FindFirstFile(szPath, &wfd);
  78.  
  79.         if (hFind == INVALID_HANDLE_VALUE) {
  80.             strcpy(s, "system\\h22capt.dll");
  81.  
  82.             hFind = FindFirstFile(szPath, &wfd);
  83.         }
  84.  
  85.         if (hFind != INVALID_HANDLE_VALUE) {
  86.             FindClose(hFind);
  87.             
  88.             CaptureWarnInit();
  89.  
  90.             if (IDYES == MessageBox(hwnd,
  91.                 "You may experience difficulty getting exact framerates "
  92.                 "with your capture card, resulting in dropped frames.  Do "
  93.                 "you want to know more about this problem?"
  94.                 ,
  95.                 "Zoran drivers detected",
  96.                 MB_YESNO)) {
  97.  
  98.                 HelpPopup(hwnd, IDH_CAPWARN_ZORAN);
  99.             }
  100.             CaptureWarnDisable(CWF_ZORAN);
  101.         }
  102.     }
  103.  
  104.     if (!(g_capwarnFlags & CWF_BROOKTREE)) {
  105.         GetWindowsDirectory(szPath, sizeof szPath);
  106.         s = szPath;
  107.         while(*s) ++s;
  108.         if (s[-1] != '\\')
  109.             *s++ = '\\';
  110.  
  111.         strcpy(s, "system\\bt848_32.dll");
  112.  
  113.         hFind = FindFirstFile(szPath, &wfd);
  114.  
  115.         if (hFind == INVALID_HANDLE_VALUE) {
  116.             strcpy(s, "system32\\bt848_32.dll");
  117.  
  118.             hFind = FindFirstFile(szPath, &wfd);
  119.         }
  120.  
  121.         if (hFind != INVALID_HANDLE_VALUE) {
  122.             FindClose(hFind);
  123.             
  124.             CaptureWarnInit();
  125.  
  126.             if (IDYES == MessageBox(hwnd,
  127.                 "You may have difficulty capturing above 320x240 with this card.  Do "
  128.                 "you want to know more about this problem?"
  129.                 ,
  130.                 "Brooktree Bt848/878 drivers detected",
  131.                 MB_YESNO)) {
  132.  
  133.                 HelpPopup(hwnd, IDH_CAPWARN_BROOKTREE);
  134.             }
  135.             CaptureWarnDisable(CWF_BROOKTREE);
  136.         }
  137.     }
  138. }
  139.  
  140.